import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { EqStructureVO, EqStructureForm, EqStructureQuery } from '@/api/system/eqStructure/types';

/**
 * 查询eq系统台账结构列表
 * @param query
 * @returns {*}
 */

export const listEqStructure = (query?: EqStructureQuery): AxiosPromise<EqStructureVO[]> => {
  return request({
    url: '/system/eqStructure/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询eq系统台账结构详细
 * @param id
 */
export const getEqStructure = (id: string | number): AxiosPromise<EqStructureVO> => {
  return request({
    url: '/system/eqStructure/' + id,
    method: 'get'
  });
};

/**
 * 新增eq系统台账结构
 * @param data
 */
export const addEqStructure = (data: EqStructureForm) => {
  return request({
    url: '/system/eqStructure',
    method: 'post',
    data: data
  });
};

/**
 * 修改eq系统台账结构
 * @param data
 */
export const updateEqStructure = (data: EqStructureForm) => {
  return request({
    url: '/system/eqStructure',
    method: 'put',
    data: data
  });
};

/**
 * 删除eq系统台账结构
 * @param id
 */
export const delEqStructure = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/eqStructure/' + id,
    method: 'delete'
  });
};
